from django import forms



class AddBetForm (forms.Form):
    mode = forms.CharField (widget = forms.HiddenInput, required = True)
    quantity = forms.ChoiceField (widget = forms.Select (), required = True);
    nums = forms.MultipleChoiceField (widget = forms.CheckboxSelectMultiple (), required = True);
    
    def __init__ (self, value = None, *args, **kwargs):
        super (AddBetForm, self).__init__ (*args, **kwargs);
        self.fields['quantity'].choices = ((i, i) for i in xrange (1, 11));
        self.fields['quantity'].widget.attrs['title'] = 'Liczba kolejnych losowan od wybranej daty';
        if value:
            self.fields['nums'].choices = ((i, i) for i in xrange (1, value));
        else:
            self.fields['nums'].choices = ((i, i) for i in xrange (1, 50));

